<?php
namespace App\Model;

/**
 * @Author:: HuangYin
 * @DateTime: 2017-01-16 11:43
 *
 * @Description:
 */
class Shopping extends BaseModel
{
    // 人民币
    const RMB = 1;
    // 银行卡
    const BANK_CARD = 2;
    // 积分
    const INTEGRAL = 3;
    // 微信
    const WE_CHAT = 4;
    // 支付宝
    const PAY_PAL = 5;
    // 会员卡
    const MEMBER_CARD = 6;
    // 礼券
    const COUPON = 7;
    // 已同步
    const SYNC = 1;
    // 未同步
    const NOT_SYNC = 2;

    protected $table = 'shopping';

    protected $visible = ['id', 'uid', 'admin_id', 'username', 'out_trade_no', 'auth_code', 'trade_no', 'card_amount',
        'amount', 'status', 'pay_type', 'pay_status', 'created_at', 'detail'];

    public function detail()
    {
        return $this->hasMany('App\Model\ShoppingDetail', 'shopping_id', 'id');
    }

    public function member()
    {
        return $this->hasOne('App\Model\Member', 'uid', 'uid');
    }
}